package netStatus

import (
	"time"
)

var OnlineStatus = false

func init() {
	go func() {
		for {
			if Ping("www.baidu.com", 1) {
				OnlineStatus = true
			} else {
				OnlineStatus = false
			}
			if OnlineStatus {
				log.Println("Device network status is online.")
			} else {
				log.Println("Device network status is offline.")
			}
			<-time.After(time.Second * 5)
		}
	}()
}
